﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GrayParrot.Web.Controls
{
    [TypeConverter(typeof(ExpandableObjectConverter))]
    public class ImageColumn : Column
    {
        public string Height { get; set; }
        public string Folder { get; set; }

        public ImageColumn()
        {
            this.Type = ColumnTypes.Image;
        }

        public override string ToString()
        {
            string m_img = string.Format("{{ \"data\": \"{0}\", \"render\": function(data, type, row) {{ return '<img id=\"img_{0}\" src=\"'+data+'\" style=\"width:auto;height:auto;max-width:{1}px;max-height:{2}px\" />'; }} }},", 
                                                     this.Name, this.Width, this.Height);

            return m_img;
        }
    }
}
